import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import ViteComponents, { AntDesignVueResolver, AntDesignVueResolverOptions } from 'vite-plugin-components'
import path from 'path'
// https://vitejs.dev/config/ 

export default defineConfig({
	plugins: [
		vue(),
		ViteComponents({
			customComponentResolvers: [AntDesignVueResolver({
				importCss: false,
				importLess: true
			})],
		}),
	],
	// 路径代理
	resolve: {
		alias: {
			'@assets': path.resolve(__dirname, 'src/assets/'),
			'@views':path.resolve(__dirname, 'src/views/'),
			'components':path.resolve(__dirname, 'src/components/'),
			'styles':path.resolve(__dirname, 'src/components/'),
			'@': path.resolve(__dirname, 'src/'),
		}
	},
	css: {
		preprocessorOptions: {
			less: {
				modifyVars: {
					// 通过这种方式修改antd-vue的主题色
					'primary-color': '#7367f0',
					// 'success-color': '#28C76F',
					// 'warning-color': '#FF9F43',
					// 'error-color': '#EA5455',
					'body-background':'#f8f8f8',
					'heading-color':'#5e5873'
				},
				javascriptEnabled: true,
			},
		},
	},
})
